KeyErrorTraceback (most recent call last)
<ipython-input-49-ee9968b17f49> in <module>()
1 ## Convert to geopandas
----> 2 gt1 = tools.toGeoDataFrame(t1,xcoord_name='Lon',ycoord_name='Lat')
/apps/external_plugins/spystats/spystats/tools.pyc in toGeoDataFrame(pandas_dataframe, xcoord_name, ycoord_name, srs)
57 """
58 data = pandas_dataframe
---> 59 data['geometry'] = data.apply(lambda z : Point(z[xcoord_name], z[ycoord_name]), axis=1)
60 #data['geometry'] = data.apply(lambda z : Point(z.LON, z.LAT), axis=1)
61
/opt/conda/envs/biospytial/lib/python2.7/site-packages/pandas/core/frame.pyc in apply(self, func, axis, broadcast, raw, reduce, args, **kwds)
4131 if reduce is None:
4132 reduce = True
-> 4133 return self._apply_standard(f, axis, reduce=reduce)
4134 else:
4135 return self._apply_broadcast(f, axis)
/opt/conda/envs/biospytial/lib/python2.7/site-packages/pandas/core/frame.pyc in _apply_standard(self, func, axis, ignore_failures, reduce)
4227 try:
4228 for i, v in enumerate(series_gen):
-> 4229 results[i] = func(v)
4230 keys.append(v.name)
4231 except Exception as e:
/apps/external_plugins/spystats/spystats/tools.pyc in <lambda>(z)
57 """
58 data = pandas_dataframe
---> 59 data['geometry'] = data.apply(lambda z : Point(z[xcoord_name], z[ycoord_name]), axis=1)
60 #data['geometry'] = data.apply(lambda z : Point(z.LON, z.LAT), axis=1)
61
/opt/conda/envs/biospytial/lib/python2.7/site-packages/pandas/core/series.pyc in __getitem__(self, key)
599 key = com._apply_if_callable(key, self)
600 try:
--> 601 result = self.index.get_value(self, key)
602
603 if not is_scalar(result):
/opt/conda/envs/biospytial/lib/python2.7/site-packages/pandas/indexes/base.pyc in get_value(self, series, key)
2151 raise InvalidIndexError(key)
2152 else:
-> 2153 raise e1
2154 except Exception: # pragma: no cover
2155 raise e1
KeyError: ('Lon', u'occurred at index 0')